package cn.iocoder.yudao.module.nginxui.controller.admin;

import cn.iocoder.yudao.framework.common.pojo.CommonResult;
import cn.iocoder.yudao.module.nginxui.controller.admin.vo.NginxStatusVO;
import cn.iocoder.yudao.module.nginxui.service.INginxStatusService;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import lombok.extern.slf4j.Slf4j;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.PostMapping;

import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import javax.annotation.security.PermitAll;


import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success;

@Tag(name = "管理后台 - nginx状态检测")
@RestController
@RequestMapping("/nginx/status")
@Validated
@Slf4j
public class NginxStatusController {

    @Resource
    private INginxStatusService nginxStatusService;

    @PostMapping("/checkLocal")
    @PermitAll
    @Operation(summary = "使用账号密码登录")
    public CommonResult<NginxStatusVO> checkLocalNginxStatus() {
        NginxStatusVO statusVO = nginxStatusService.checkLocalNginxStatus();
        return success(statusVO);
    }

}
